<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 7.3.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">

<link rel="stylesheet" href="//fonts.googleapis.com/css?family=ZCOOL XiaoWei:300,300italic,400,400italic,700,700italic&display=swap&subset=latin,latin-ext">
<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"czchenzhan.github.io","root":"/","scheme":"Pisces","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":true,"trigger":"auto","top_n_per_article":10,"unescape":true,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},"path":"./public/search.xml"};
  </script>

  <meta name="description" content="利用Hexo和GitHub Pages搭建个人博客&emsp;&emsp;博主在利用Hexo和GitHub Pages创建本博客网站时，几经波折得以建成，又几经波折得以发送出人生中第一篇博客。现将流程及所遇问题梳理如下，唯望前人栽树，后人乘凉。">
<meta property="og:type" content="article">
<meta property="og:title" content="第一篇博客献给建博客的自己">
<meta property="og:url" content="https://czchenzhan.github.io/2024/10/20/%E5%88%A9%E7%94%A8Hexo%E5%92%8CGitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/index.html">
<meta property="og:site_name" content="陈展的博客">
<meta property="og:description" content="利用Hexo和GitHub Pages搭建个人博客&emsp;&emsp;博主在利用Hexo和GitHub Pages创建本博客网站时，几经波折得以建成，又几经波折得以发送出人生中第一篇博客。现将流程及所遇问题梳理如下，唯望前人栽树，后人乘凉。">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://czchenzhan.github.io/2024/10/20/%E5%88%A9%E7%94%A8Hexo%E5%92%8CGitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/%E5%88%9B%E5%BB%BA%E4%BB%93%E5%BA%93.png">
<meta property="og:image" content="https://czchenzhan.github.io/2024/10/20/%E5%88%A9%E7%94%A8Hexo%E5%92%8CGitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/%E5%88%9B%E5%BB%BAssh%E5%AF%86%E9%92%A5.png">
<meta property="og:image" content="https://czchenzhan.github.io/2024/10/20/%E5%88%A9%E7%94%A8Hexo%E5%92%8CGitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/%E4%BB%A3%E7%A0%81%E7%A4%BA%E8%8C%831.png">
<meta property="article:published_time" content="2024-10-19T16:00:00.000Z">
<meta property="article:modified_time" content="2025-04-20T09:24:30.382Z">
<meta property="article:author" content="作者：陈展">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://czchenzhan.github.io/2024/10/20/%E5%88%A9%E7%94%A8Hexo%E5%92%8CGitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/%E5%88%9B%E5%BB%BA%E4%BB%93%E5%BA%93.png">

<link rel="canonical" href="https://czchenzhan.github.io/2024/10/20/%E5%88%A9%E7%94%A8Hexo%E5%92%8CGitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>

  <title>第一篇博客献给建博客的自己 | 陈展的博客</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">陈展的博客</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
      <p class="site-subtitle" itemprop="description">记录点滴</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="main-menu menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a>

  </li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup">
        <div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div id="search-result">
  <div id="no-result">
    <i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>
  </div>
</div>

    </div>
  </div>

</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://czchenzhan.github.io/2024/10/20/%E5%88%A9%E7%94%A8Hexo%E5%92%8CGitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="作者：陈展">
      <meta itemprop="description" content="欢迎到访">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="陈展的博客">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          第一篇博客献给建博客的自己
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2024-10-20 00:00:00" itemprop="dateCreated datePublished" datetime="2024-10-20T00:00:00+08:00">2024-10-20</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2025-04-20 17:24:30" itemprop="dateModified" datetime="2025-04-20T17:24:30+08:00">2025-04-20</time>
              </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <h1 id="利用Hexo和GitHub-Pages搭建个人博客"><a href="#利用Hexo和GitHub-Pages搭建个人博客" class="headerlink" title="利用Hexo和GitHub Pages搭建个人博客"></a>利用Hexo和GitHub Pages搭建个人博客</h1><p>&emsp;&emsp;博主在利用Hexo和GitHub Pages创建本博客网站时，几经波折得以建成，又几经波折得以发送出人生中第一篇博客。现将流程及所遇问题梳理如下，唯望前人栽树，后人乘凉。</p>
<span id="more"></span>

<!-- toc -->

<h2 id="1、预备工作"><a href="#1、预备工作" class="headerlink" title="1、预备工作"></a>1、预备工作</h2><p>&emsp;&emsp;环境准备：安装<span style="background-color: yellow;">Node.js</span>，用于使用npm包管理器，附官网 <a target="_blank" rel="noopener" href="https://nodejs.org/en">https://nodejs.org/en</a></p>
<p>&emsp;&emsp;工具准备：安装<span style="background-color: yellow;">Git</span>，用于远程拉取和上传，附官网<a target="_blank" rel="noopener" href="https://git-scm.com/">https://git-scm.com/</a></p>
<p>&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;安装<span style="background-color: yellow;">VsCode</span>，用于后期修改代码，附官网<a target="_blank" rel="noopener" href="https://code.visualstudio.com/">https://code.visualstudio.com/</a></p>
<p>&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;安装<span style="background-color: yellow;">Typora</span>，用于更方便的编写Markdown文档，需收费，附官网<a target="_blank" rel="noopener" href="https://typora.io/">https://typora.io/</a></p>
<p>&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;(可以逃课，CSDN博主阿辉的日常：<a target="_blank" rel="noopener" href="https://blog.csdn.net/qq_56746297/article/details/141232176?ops_request_misc=&request_id=&biz_id=102&utm_term=typora%E7%A0%B4%E8%A7%A3%E7%89%88%E5%AE%89%E8%A3%85%E6%95%99%E7%A8%8B&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~sobaiduweb~default-0-141232176.nonecase&spm=1018.2226.3001.4450">Typora2024最新版破解方法（博主亲测可用）</a>)</p>
<p>&emsp;&emsp;账号准备：注册<span style="background-color: yellow;">GitHub账号</span>，用来搭建仓库，附官网<a target="_blank" rel="noopener" href="https://github.com/">https://github.com/</a></p>
<p>&emsp;&emsp;前置知识：知晓<span style="background-color: yellow;">Markdown语法</span>、有HTML基础会好</p>
<h2 id="2、初始化GitHub仓库"><a href="#2、初始化GitHub仓库" class="headerlink" title="2、初始化GitHub仓库"></a>2、初始化GitHub仓库</h2><p>&emsp;&emsp;创建GitHub仓库：进入自己的GitHub账号主页，在Repositories中找到“New”跳转到仓库创建页面</p>
<hr>
<p>&emsp;&emsp;<img src="/2024/10/20/%E5%88%A9%E7%94%A8Hexo%E5%92%8CGitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/%E5%88%9B%E5%BB%BA%E4%BB%93%E5%BA%93.png" title="创建仓库"></p>
<hr>
<p>&emsp;&emsp;如图进行填写勾选，<span style="background-color: red;">注</span>：Repository name处必须填“<span style="background-color: yellow;">账号名字.github.io</span>”</p>
<h2 id="3、初始化Hexo"><a href="#3、初始化Hexo" class="headerlink" title="3、初始化Hexo"></a>3、初始化Hexo</h2><p>&emsp;&emsp;[1]、在电脑选一个喜欢的位置，新建一个文件夹作为博客文件夹，比如博主的博客就建在：D:\Blog</p>
<p>&emsp;&emsp;[2]、该目录下点击上方地址栏，输入cmd，打开命令行窗口，输入以安装Hexo：<span style="background-color: yellow;">npm i hexo-cli -g</span></p>
<p>&emsp;&emsp;[3]、同样是该窗口，输入：<span style="background-color: yellow;">npm install</span>，下载依赖</p>
<p>&emsp;&emsp;[4]、安装完成后即可初始化Hexo：<span style="background-color: yellow;">hexo init</span></p>
<p>&emsp;&emsp;恭喜你，到这一步你已经可以在本地运行你的博客了，不要关闭命令行窗口，输入：<span style="background-color: yellow;">hexo s</span>看看成果</p>
<p>&emsp;&emsp;虽然很丑而且还不能远程访问，不过果子得一口口吃，都会有的</p>
<h2 id="4、实现远程部署"><a href="#4、实现远程部署" class="headerlink" title="4、实现远程部署"></a>4、实现远程部署</h2><p>&emsp;&emsp;这一步，我们要使自己的博客能够被远程访问，即通过网址让他人能看到你的博客，最终效果就是你可以在离我不知道多远的地方看我的文章๑乛◡乛๑</p>
<p>&emsp;&emsp;[1]、同样，我们不需要关闭命令行窗口(当然如果你关闭了，重新打开就是了)，输入：<span style="background-color: yellow;">ssh</span>，检查ssh是否可用</p>
<p>&emsp;&emsp;[2]、无异常后，输入两行代码，让Git知道你的GitHub账号信息：</p>
<p>&emsp;&emsp;<code>git config --global user.name &quot;GitHub账号名&quot; </code></p>
<p>&emsp;&emsp;<code>git config --global user.email &quot;GitHub账号注册邮箱&quot;</code></p>
<p>&emsp;&emsp;[3]、在本地创建ssh秘钥，输入：</p>
<p>&emsp;&emsp;<code>ssh-keygen -t rsa -C &quot;GitHub账号注册邮箱&quot;</code></p>
<p>&emsp;&emsp;程序会出现三次暂停等候输入，不用理会直接跳过。随后会出现如下界面：</p>
<hr>
<p>&emsp;&emsp;<img src="/2024/10/20/%E5%88%A9%E7%94%A8Hexo%E5%92%8CGitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/%E5%88%9B%E5%BB%BAssh%E5%AF%86%E9%92%A5.png" title="创建ssh密钥"></p>
<hr>
<p>&emsp;&emsp;[4]、完成后，根据上图第三行代码括号中路径，找到<span style="background-color: orange;">id_rsa.pub</span>文件，用记事本打开，复制密钥</p>
<p>&emsp;&emsp;[5]、来到GitHub个人主页，点击右上方个人账号头像，找到“Settings”，接着点击“SSH and GPG keys”</p>
<p>&emsp;&emsp;[6]、界面右侧会有绿色按钮“New SSH key”，点击，密钥名字任意，然后在“Key”处输入复制的密钥</p>
<p>&emsp;&emsp;[7]、密钥生成后，可以在原命令行窗口输入以检查是否有异：</p>
<p>&emsp;&emsp;<code>ssh git@github.com</code></p>
<p>&emsp;&emsp;密钥密钥，自然是保护用的，密钥生成使用后，GitHub便只允许本地有私钥文件的电脑进行内容推送，你的博客才不会被随意篡改</p>
<p>&emsp;&emsp;[8]、闲谈结束，接下来我们要让博客被推送到GitHub仓库中，首先下载必需插件：<span style="background-color: yellow;">npm install hexo-deployer-git –save</span></p>
<p>&emsp;&emsp;[9]、打开你的博客文件夹，找到<span style="background-color: orange;">_config.yml</span>文件，，用准备好的VsCode打开。这是博客的配置文件，之后的样式、文字、功能等修改都需要在此对代码进行修改</p>
<p>&emsp;&emsp;[10]、ctrl+快捷键搜索：<span style="background-color: yellow;">deploy</span>，并将此处代码修改为如下图示例：</p>
<hr>
<p>&emsp;&emsp;<img src="/2024/10/20/%E5%88%A9%E7%94%A8Hexo%E5%92%8CGitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/%E4%BB%A3%E7%A0%81%E7%A4%BA%E8%8C%831.png" title="代码示范"></p>
<hr>
<p>&emsp;&emsp;显然，在“repo”这一行，大家应修改为：</p>
<p>&emsp;&emsp;<code>git@github.com:GitHub账号名/GitHub账号名.github.io.git</code></p>
<p>&emsp;&emsp;[11]、在原命令行窗口下，生成静态文件，输入：<span style="background-color: yellow;">hexo g</span></p>
<p>&emsp;&emsp;[12]、上传到GitHub，输入：<span style="background-color: yellow;">hexo d</span></p>
<p>&emsp;&emsp;如果你成功完成了上述十二步，现在是享受劳动成果的时候了，<span style="background-color: yellow;">https:&#x2F;&#x2F;账号名.github.io</span>，这就是专属于你的博客网址啦！&lt;(￣︶￣)&gt;</p>
<h2 id="5、使用更美观的主题（可选）"><a href="#5、使用更美观的主题（可选）" class="headerlink" title="5、使用更美观的主题（可选）"></a>5、使用更美观的主题（可选）</h2><p>&emsp;&emsp;有点丑，至少我是这么想的。来选个好看的主题吧，博主这里推荐Next主体和Butterfly主体，博主会以自身博客为例，讲解下载、使用Next主题。</p>
<p>&emsp;&emsp;[1]、打开GitHub，在搜索框搜索：<span style="background-color: yellow;">hexo next</span>，没错，这是GitHub大佬的杰作，点击“Code”，下载zip压缩包，解压到博客文件夹中的“theme”目录下</p>
<p>&emsp;&emsp;[2]、在博客文件夹目录的<span style="background-color: orange;">_config.yml</span>文件修改配置theme：</p>
<p>&emsp;&emsp;<code>theme: next</code></p>
<p>&emsp;&emsp;可以先在本地运行一下博客看看有没有成功更换主题，没忘吧•⌄•(忘了就参考第三板块倒数第二句)</p>
<p>&emsp;&emsp;[3]、当然，Next主体可更改的属性有很多，博主也还在学习怎么把博客变得更个性化，不过这不是有大佬嘛，推荐CSDN博主ywang_wnlo：<a target="_blank" rel="noopener" href="https://blog.csdn.net/CoolBoySilverBullet/article/details/121719830?ops_request_misc=%257B%2522request%255Fid%2522%253A%25226298D213-4C23-421C-88C8-99A1DE4019D6%2522%252C%2522scm%2522%253A%252220140713.130102334..%2522%257D&request_id=6298D213-4C23-421C-88C8-99A1DE4019D6&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~sobaiduend~default-1-121719830-null-null.nonecase&utm_term=hexonext&spm=1018.2226.3001.4450">【Hexo】NexT 主题的配置使用记录</a></p>
<h2 id="6、发表第一篇博客"><a href="#6、发表第一篇博客" class="headerlink" title="6、发表第一篇博客"></a>6、发表第一篇博客</h2><p>&emsp;&emsp;来吧，发篇博客体验一下，打开你的Typora开始写文咯，这里我将讲述我新建文章的方法</p>
<p>&emsp;&emsp;[1]、新建一个.md文件，在利用Typora完成编写后，将文件另存到：<span style="background-color: yellow;">hexo next博客文件夹&#x2F;source&#x2F;_posts&#x2F;</span></p>
<p>&emsp;&emsp;[2]、在博客文件夹下通过cmd命令打开命令行窗口，依次输入以下三行代码，我简称为“三板斧”：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">hexo clean </span><br><span class="line">hexo g</span><br><span class="line">hexo d</span><br></pre></td></tr></table></figure>

<p>&emsp;&emsp;通过上述三行代码，你的Hexo博客和GitHub仓库会被更新，写好的md文件也会挂在博客上</p>
<p>&emsp;&emsp;<span style="background-color: red;">注</span>：在每次修改博客文件夹中内容后，都需运行一遍“三板斧”，才会在博客中生效</p>
<h2 id="7、可能出现的报错及解决方案"><a href="#7、可能出现的报错及解决方案" class="headerlink" title="7、可能出现的报错及解决方案"></a>7、可能出现的报错及解决方案</h2><p>&emsp;&emsp;来说说我目前在建博客上碰到的壁，满满血泪史(Ｔ▽Ｔ)</p>
<p>&emsp;&emsp;[1]、在使用npm包管理器下载<span style="background-color: yellow;">hexo-cli</span>时卡住，可尝试两种手段</p>
<p>&emsp;&emsp;&emsp;①、修改npm源为阿里的镜像源，不使用国外服务器：</p>
<p>&emsp;&emsp;&emsp;<code>npm install -g cnpm --registry=https://registry.npm.taobao.org</code></p>
<p>&emsp;&emsp;&emsp;②、未下载依赖：<span style="background-color: yellow;">npm install</span></p>
<p>&emsp;&emsp;随后重新进行<span style="background-color: yellow;">hexo-cli</span>下载，即重新进行3~[2]，若使用手段①，只需将命令开头的npm改为<span style="background-color: yellow;">cnpm</span></p>
<p>&emsp;&emsp;[2]、检查自己创建的仓库是不是公开的，即“Public”，若不是，在该步骤会出现问题：4~[12]</p>
<p>&emsp;&emsp;[3]、一定是根据4~[5]找到“Settings”，而不是在仓库的“Settings”中的“Deploy keys”中操作</p>
<p>&emsp;&emsp;以下是在写文章时遇到的问题(っ╥╯﹏╰╥c)</p>
<p>&emsp;&emsp;[4]、如果你想根据标题建立目录，不要使用Typora的一键目录，使用：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">&lt;!--toc--&gt;</span><br></pre></td></tr></table></figure>

<p>&emsp;&emsp;[5]、不知为何，当使用Markdown文件的高亮语法“&#x3D;&#x3D;高亮内容&#x3D;&#x3D;”时，Hexo上无法显示，这里可以直接使用HTML语法：</p>
<p>&emsp;&emsp;<code>&lt;span style=&quot;background-color: yellow;&quot;&gt;高亮内容&lt;/span&gt;</code></p>
<p>&emsp;&emsp;[6]、为了插入图片，我也同样撞了两次壁，查了百度，查了CSDN，找到成功方案，以下使用C++注释风格：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">//在博客文件夹的_config.yml文件修改</span><br><span class="line">post_asset_folder: true</span><br><span class="line">marked:</span><br><span class="line">  prependRoot: true</span><br><span class="line">  postAsset: true</span><br><span class="line">//在博客文件夹下打开命令行窗口，安装新插件</span><br><span class="line">npm install hexo-asset-img --save</span><br><span class="line">//在/source/_posts/中建立一个同md文件相同名字的文件夹，将图片存放进去</span><br><span class="line">//插入图片的语法必须要求如下(至少咱试了下其他的，都没出来)</span><br><span class="line">！[](图片路径/图片名.图片后缀 &quot;图片名&quot;) // 路径使用相对路径</span><br></pre></td></tr></table></figure>

<p>&emsp;&emsp;看到这里，肯定有些人没有找到想要的解决方案，没关系，CSDN嘛，总会找到的，期待你的博客！</p>
<p>&emsp;&emsp;╭（′▽‵）╭（′▽‵）╭（′▽‵）╯</p>

    </div>

    
    
    

      <footer class="post-footer">

        


        
    <div class="post-nav">
      <div class="post-nav-item"></div>
      <div class="post-nav-item">
    <a href="/2024/11/11/Go%E8%AF%AD%E8%A8%80%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0/" rel="next" title="Go语言学习笔记">
      Go语言学习笔记 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#%E5%88%A9%E7%94%A8Hexo%E5%92%8CGitHub-Pages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2"><span class="nav-number">1.</span> <span class="nav-text">利用Hexo和GitHub Pages搭建个人博客</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#1%E3%80%81%E9%A2%84%E5%A4%87%E5%B7%A5%E4%BD%9C"><span class="nav-number">1.1.</span> <span class="nav-text">1、预备工作</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2%E3%80%81%E5%88%9D%E5%A7%8B%E5%8C%96GitHub%E4%BB%93%E5%BA%93"><span class="nav-number">1.2.</span> <span class="nav-text">2、初始化GitHub仓库</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3%E3%80%81%E5%88%9D%E5%A7%8B%E5%8C%96Hexo"><span class="nav-number">1.3.</span> <span class="nav-text">3、初始化Hexo</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#4%E3%80%81%E5%AE%9E%E7%8E%B0%E8%BF%9C%E7%A8%8B%E9%83%A8%E7%BD%B2"><span class="nav-number">1.4.</span> <span class="nav-text">4、实现远程部署</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#5%E3%80%81%E4%BD%BF%E7%94%A8%E6%9B%B4%E7%BE%8E%E8%A7%82%E7%9A%84%E4%B8%BB%E9%A2%98%EF%BC%88%E5%8F%AF%E9%80%89%EF%BC%89"><span class="nav-number">1.5.</span> <span class="nav-text">5、使用更美观的主题（可选）</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#6%E3%80%81%E5%8F%91%E8%A1%A8%E7%AC%AC%E4%B8%80%E7%AF%87%E5%8D%9A%E5%AE%A2"><span class="nav-number">1.6.</span> <span class="nav-text">6、发表第一篇博客</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#7%E3%80%81%E5%8F%AF%E8%83%BD%E5%87%BA%E7%8E%B0%E7%9A%84%E6%8A%A5%E9%94%99%E5%8F%8A%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88"><span class="nav-number">1.7.</span> <span class="nav-text">7、可能出现的报错及解决方案</span></a></li></ol></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <p class="site-author-name" itemprop="name">作者：陈展</p>
  <div class="site-description" itemprop="description">欢迎到访</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives">
          <span class="site-state-item-count">7</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">2</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">3</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2025</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">作者：陈展</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://pisces.theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Pisces</a> 强力驱动
  </div>

        








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/pisces.js"></script>


<script src="/js/next-boot.js"></script>




  




  
<script src="/js/local-search.js"></script>













  

  

</body>
</html>
